package com.zbg;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "ServletRedrict",urlPatterns = "/ServletRedrict")
public class ServletRedrict extends HttpServlet {
    @Override
    public void destroy() {
        System.out.println("ServletRedrict销毁");
    }

    @Override
    public void init() throws ServletException {
        System.out.println("ServletRedrict创建");
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("孙悟空到此一游");
        response.sendRedirect("http://localhost:8080/servlet02/index.jsp");
    }
}
